//
//  ByViewMineButton.m
//  itboye_shop_ios
//
//  Created by justiOS on 17/2/10.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByViewMineButton.h"

@implementation ByViewMineButton

// 自定义按钮初始化方法
- (id)initWithFrame:(CGRect)frame
              Image:(UIImage *)image
              Title:(NSString *)title
               Font:(NSInteger)font
              Color:(UIColor *)color
{
    self = [super initWithFrame:frame];
    if (self) {
        // 创建按钮子视图
        [self _createSubviews];
        _buttonImageView.image = image;
        _buttonLabel.text = title;
        _buttonLabel.font = FONT(font);
        _buttonLabel.textColor = color;
    }
    return self;
}


// 创建按钮子视图
- (void)_createSubviews {
    CGFloat width = self.width;
    CGFloat height = self.height;
    
    // 创建buttonImageView，
    _buttonImageView = [[UIImageView alloc] initWithFrame:CGRectMake(width *3.3/10, height/3 - 10,  width *3.4/10, width *3.4/10)];
    _buttonImageView.contentMode = UIViewContentModeScaleAspectFit;
    [self addSubview:_buttonImageView];
    
    // 创建buttonLabel，按钮图片下边文字
    _buttonLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, width *4/10 + 5 , width, height - (width *4 / 10) - 5)];
    _buttonLabel.textColor = [UIColor darkGrayColor];
    _buttonLabel.textAlignment = NSTextAlignmentCenter;
    _buttonLabel.font = FONT(12);
    [self addSubview:_buttonLabel];
}



@end
